﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace _2015.DivAdmin
{
    public partial class DivAdminTrainingProgAdd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            String Name = (String)Session["LoggingInfo"];
            String Position = (String)Session["LoggingPosition"];
            String username = (String)Session["LoggingInfoUsername"];
            LabelDivAdminName.Text = Name;
            LabelDivAdminPosition.Text = "(" + Position + ")";

            ImageProfile.ImageUrl = "../ProfilePicHandler.ashx?uname=" + username;

            Session["CalLoggingInfo"] = Name;
            Session["CalLoggingPosition"] = Position;
            Session["CalLoggingInfoUsername"] = username;
        }

        protected void ButtonLogout_Click(object sender, EventArgs e)
        {
            Response.Redirect("../Login/SignIn.aspx");
        }

        protected void Button1_Click1(object sender, EventArgs e)
        {
            string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
            using (SqlConnection con = new SqlConnection(CS))
            {
                SqlCommand cm = new SqlCommand("sptrain", con);
                cm.CommandType = System.Data.CommandType.StoredProcedure;

                cm.Parameters.AddWithValue("@Employee_Name", TextBox1.Text);
                cm.Parameters.AddWithValue("@Employee_Id", TextBox2.Text);
                cm.Parameters.AddWithValue("@department_name", DropDownList1.SelectedItem);
                cm.Parameters.AddWithValue("@Training_program", DropDownList2.SelectedItem);
                cm.Parameters.AddWithValue("@Training_Duration", DropDownList3.SelectedItem);
                cm.Parameters.AddWithValue("@Project_field", DropDownList4.SelectedItem);



                con.Open();
                cm.ExecuteNonQuery();

            }
        }
    }
    
}